package cn.odore.basic.util;

import lombok.Data;

@Data
public class AjaxResult {
    private Boolean success = true;
    private String msg = "操作成功";
    private Object resultObj;

    // 成功调用
    public AjaxResult() {
    }

    // 失败调用
    public AjaxResult(String msg) {
        this.success = false;
        this.msg = msg;
    }

    public static AjaxResult me(){
        return new AjaxResult();
    }

    // 链式编程，设置完成后将自己对象返回
    public AjaxResult setSuccess(Boolean success){
        this.success = success;
        return this;
    }

    public AjaxResult setMsg(String msg){
        this.msg = msg;
        return this;
    }
}
